import 'package:flutter/material.dart';
import 'package:full_display/common/qxp_color.dart';
import 'package:full_display/common/qxp_style.dart';
import 'package:full_display/unit/screen/screen_utility.dart';

class ButtonTextWidget extends StatelessWidget {
  final String title;
  int index;
  final bool state;
  final double width;
  final double height;
  Function(int) tapAction;
  ButtonTextWidget(
      {Key? key,
      required this.title,
      required this.index,
      required this.state,
      required this.width,
      required this.height,
      required this.tapAction})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        tapAction(index);
      },
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            padding: EdgeInsets.only(top: 2.0.W),
            height: height,
            width: width,
            decoration: BoxDecoration(
              gradient: LinearGradient(
                  //渐变位置
                  begin: Alignment.topCenter, //右上
                  end: Alignment.bottomCenter, //左下
                  //渐变颜色[始点颜色, 结束颜色]
                  colors: state == true
                      ? [ColorPlate.app_blue, ColorPlate.sub_blue]
                      : [
                          ColorPlate.backgroundOpacity5,
                          ColorPlate.backgroundOpacity5
                        ]),
              borderRadius: BorderRadius.all(Radius.circular(12.0.H)),
            ),
            child: Text(
              title,
              textAlign: TextAlign.center,
              style: StandardTextStyle.textWhite12Style,
            ),
          ),
        ],
      ),
    );
  }
}
